﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

[CreateAssetMenu(fileName ="Attack",menuName ="gameplay/skills/Attack")]
public class Attack : Skill
{

    public override void Cast()
    {
        base.Cast();
        TargetChooser.ChooseInTeam(user.getOpponentTeam());

    }

    public override void Effect()
    {
        base.Effect();
        TakeDamage(GetSkillDamage());
    }

    public override int GetSkillDamage()
    {
        return (int)(user.data.attack * user.attackRate * target.defenceRate);
    }

    public void TakeDamage(int damage)
    {
        if (target.currentHp - damage <= 0)
        {
            target.currentHp = 0;
        }
        else
        {
            target.currentHp -= damage;
        }
    }
}
